import QtQuick 2.7
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.5
import QtQml.Models 2.13
import QtQuick.Controls.Styles 1.4
import et.exportxlsx 1.0

Window {
    id:root
    visible: true
    width: 640
    height: 480
    title: qsTr("CT报表 V1.0")

    ColumnLayout{
        spacing: 2

        RowLayout{
            id:firstrow
            Layout.preferredHeight: 30
            Layout.margins: 1
            spacing: 2
            Rectangle {
                color: "white"
                border.color: "gray"
                Layout.fillWidth: true
                Layout.minimumWidth: 200
                Layout.preferredWidth: 200
                Layout.maximumWidth: 300
                Layout.minimumHeight: 25
                TextInput {
                    id: conditiona
                    text: qsTr("")
                    width: parent.width
                    font.pointSize: 18
                    selectByMouse: true
                }
            }

            Button{
                text: qsTr("查找");
                Layout.preferredHeight: 25;
                Layout.preferredWidth: 120;
                //style:btnStyle;//Controls 1.x

            }
            Button{
                text: qsTr("导出xlsx");
                Layout.preferredHeight: 25;
                Layout.preferredWidth: 120;
                //style:btnStyle;//Controls 1.x
                onClicked: {
                    busyDialog.visible=true;
                    exportxlsx.create();
                    busyDialog.visible=false;
                }
            }
        }

        //            ResultsListView{}
        ResultsTableView{
            Layout.fillWidth: true;
            Layout.fillHeight: true;
            Layout.preferredWidth: root.width;
            Layout.preferredHeight: root.height-firstrow.height;
        }

    }
    Component{
        id:btnStyle;
        ButtonStyle{
            background: Rectangle{
                implicitWidth: 120;
                implicitHeight: 25;
                color: "#DDDDDD";
                border.width: control.hovered ? 2 : 1;
                border.color: control.hovered ? "green" : "#888888";
            }
        }
    }
    Exportxlsx{
        id:exportxlsx
    }
    BusyIndicator{
        id:busyDialog
        visible: false
        anchors.centerIn: parent
    }
}
